package com.goodlearning.gloriamobile.activity;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.goodlearning.gloriamobile.R;
import com.goodlearning.gloriamobile.commons.Utils;

/**
 * 학사 행정 변경된 Activity
 * 
 * @author rapty54
 * 
 */
public class Administration extends BaseActivity {

	TextView bodyButton;

	int resourceId[] = {R.id.button_in_progress_class
			,R.id.button_the_end_of_the_class
			,R.id.button_check_the_schedule
			,R.id.button_Tuition_View };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ba_of_administration_body_layout);
		init();
	}

	public void init() {
		View dividerline = (View) findViewById(R.id.divider_layout_line_1);
		dividerline.setVisibility(View.VISIBLE);
		baseTitleLeftBtn.setVisibility(View.INVISIBLE);
		baseTitleRightBtn.setVisibility(View.INVISIBLE);
		baseTitleTv.setText("학사행정");
		buttonBodySetting();
	}

	/**
	 * 모든 리소스 여기서 이벤트 걸어준다
	 */
	public void buttonBodySetting() {
		for (int countIndex = 0; countIndex < resourceId.length; countIndex++) {
			final int resource = resourceId[countIndex];
			bodyButton = (TextView) findViewById(resource);
			
			switch (resource) {
			case R.id.button_in_progress_class:
				bodyButton.setText("v "+"진행 중 강의 확인하기");
				break;
			
			default:
				break;
			
			}
			
			bodyButton.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {
					switch (resource) {
					case R.id.button_in_progress_class:
						Utils.log("button_in_progress_class");
						Utils.changeActivity(Administration.this, AdministrationInProgress.class);
						break;
					case R.id.button_the_end_of_the_class:
						Utils.log("button_the_end_of_the_class");
						Utils.changeActivity(Administration.this, AdministrationInTheEnd.class);
						break;
					case R.id.button_check_the_schedule:
						Utils.log("button_check_the_schedule");
						Utils.changeActivity(Administration.this, AdministrationCheckSchedule.class);
						break;
					case R.id.button_Tuition_View:
						Utils.log("button_Tuition_View");
						Utils.changeActivity(Administration.this, AdministrationPayTution.class);
						break;
					default:
						break;
					}
				}
			});
		}
	}

	/**
	 * 종료와 동시에 logout 도 모두 한다.
	 */
	@Override
	public void onBackPressed() {
		Utils.showConfirmDialog(Administration.this, "종료",
				"글로리아 모바일을 종료 하시겠습니까?", new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {

						allClearActivity();

					}
				}, null);
	}
}
